/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package slicktemplate;

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.Sound;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.state.transition.*;

public class LevelLose extends BasicGameState {

    private int id;
    private float changescreen = 1000;
    Image loser;
    private int drawthis = 0;
    Sound introSound;

    public LevelLose(int id) {
        this.id = id;
        try {
            introSound = new Sound("sounds/losstheme.ogg");}
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void enter(GameContainer container, StateBasedGame game) throws SlickException {
        super.enter(container, game);
        introSound.loop();
    }

    @Override
    public int getID() {
        return id;
    }

    @Override
    public void init(GameContainer container, StateBasedGame game) throws SlickException {
        try {
            loser = new SerializableImage("sprites/youlose.png"); //try to load the sprite

            // introSound = new Sound("");
            //  introSound.play();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
        loser.draw(0, 0);
    }

    @Override
    public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
        if (container.getInput().isKeyPressed(Input.KEY_ESCAPE)) {
            container.exit();
        }

    }
}
